home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
vol16n12.zip
/
IPC.ZIP
/
CATCH.ZIP
/
CATCHDLG.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-12
|
2KB
|
104 lines
// CatchDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Catch.h"
#include "CatchDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCatchDlg dialog
CCatchDlg::CCatchDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCatchDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCatchDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadStandardIcon(IDI_WINLOGO);
}
void CCatchDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCatchDlg)
DDX_Control(pDX, IDC_LISTBOX, m_wndListBox);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCatchDlg, CDialog)
//{{AFX_MSG_MAP(CCatchDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_CLEAR_ALL, OnClearAll)
//}}AFX_MSG_MAP
ON_MESSAGE (WM_COPYDATA, OnCopyData)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCatchDlg message handlers
BOOL CCatchDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
return TRUE;
}
void CCatchDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
HCURSOR CCatchDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
LONG CCatchDlg::OnCopyData (UINT wParam, LONG lParam)
{
PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT) lParam;
TCHAR* pString = new TCHAR[pcds->dwData];
::CopyMemory (pString, pcds->lpData, pcds->cbData);
pString[pcds->dwData - 1] = 0; // Just to be sure
m_wndListBox.InsertString (0, (LPCTSTR) pString);
delete[] pString;
return 1;
}
void CCatchDlg::OnClearAll()
{
m_wndListBox.ResetContent ();
}